# # 私有属性
#
# class cat:
#     def __init__(self,age, weight):
#         self.__age = age
#         self.__weight = weight
#  私有属性在属性前加__,注:加完之后就不能实现print(w.age,w.weight)
#  只看可以通过本方法内print(f'我今年{self.__age}岁,体重{self.__weight}斤')实现或者创建新的方法用判断调用显示

#     def show(self,password):
#         if password == '123456':
#             print(f'我今年{self.__age}岁,体重{self.__weight}斤')
#             self.__h()
#         # 直接写调用不了私有属性需要加判断
#         else:
#             print('密码不对')
#
#     def __h(self):
#         print('我爱睡觉')
#
#
# w = cat(20,2000)
# # print(w.age, w.weight)
# w.show('1234')


# 设置固定范围属性值

# class cat():
#     def __init__(self, age):
#         if age >= 1 and age <=100:
#             self.__age = age
#         else:
#             self.__age = 1

#     def dog(self):
#
#         print(self.__age)
#
#
#
# w = cat(10)
# w.dog()

#
# class dog():
#     def __init__(self, age = 1):
#         self.__age = age
#         print(self.__age)
#
#     # def sleep(self):
#     #     print('睡....')
#
# class fish(dog):
#     def __init__(self, name):
#         self.name = name
#
#
#     def h(self): #包含了age
#         print('哈哈哈')
#
#
#
#
#
# w = cat()
# w.sleep()  # 继承还需要输入父类的方法名
# # w.color()  # 注意:调用是.方法不是.类
# d = fish('哮天犬')
# print(d.name)
# print(d.name)
# print(d.h())
#
# d.h()


#
#
# class father():
#     def __init__(self, house = 2, name = '哈'):
#         self.__name =name
#         self.house = house
#
#     def eat(self):
#         print('吃')
#
#     def sleep(self):
#         print('睡')
#
#     def __edu_back(self):
#         print('你继承不了我')
#
# class son(father):
#     pass
#     # def h(self):
#     #     self.house = 5
#
#
#
# w = son(5)
# w.eat()
# w.sleep()
# print(w.house)


#
# class h():
#     def food(self):
#         pass
#     def eat(self):
#         self.food()
#
# class dog(h):
#     def food(self):
#         print('吃屎')
#
# class fish(h):
#     def food(self):
#         print('喝尿')
#
# w =dog()
# w.food()
# k = fish()
# k.food()


# # 类方法
# class dog():
#     name = '张小三' #类属性
#
#     def __init__(self,age = 1):
#         self.age = age
# #不需要创建对象
# print(dog.name)   #显示类属性
# dog.name = '李四'   #修改类属性
#
#
# w =dog()        #创建对象
# print(w.age)   #显示普通属性值
# w.age = 5      #修改普通属性值


# # 类方法
# class dog():
#     @classmethod  # 定义类方法
#     def eat(cls):  # 类方法
#         print('吃')
#
#     def sleep(self):  # 普通方法
#         print('睡')
#
#
# dog.eat()  # 类方法
#
# w = dog()  # 普通方法   注意:创建对象要用变量=类  要有()
# w.sleep()



# class cat:
#     name ='张三'
#     @classmethod
#     def fang(cls,name= 'a'):
#         cls.name = name
#         print(cls.name)
#
#     # @classmethod
#     # def gai(cls):
#     #     return cls.name
#
# cat.fang('李四')
# print(cat.gai())

#调用类属性或者类方法直接用类.属性或者方法-----> 普通方法调用类属性方法


# 静态方法

# class dog():
#     @staticmethod
#     def help():
#         print('我是静态方法')
#
# dog.help()   #类名.方法名   独立存在
#
# class my_class():
#     __sum = 0
#     def __init__(self):
#         my_class.__sum+= 1
#
#
#     @classmethod
#     def count(cls):
# #         print(cls.__sum)
#
# class coder:
#     def __init__(self, money = 10000000):
#         self.__money = money
#     def work(self):
#         pass
#     def sleep(self):
#         pass
#     def __imagine(self):
#         pass
#
# class xiaowang(coder):
#     company = '传智播客'
#     def show_company(self):
#         print(self.company)
#     def work(self):
#         pass
#     @staticmethod
#     def test():
#         print('这是一个静态方法')

#
# def line():
#     print('-' * 100)
# num = int(input('请输入打印的行数'))
# for i in range
# line()
